home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2006 February / Gamestar_81_2006-02_dvd.iso / Red Shark / Missions / Mission_11 / Mission.script < prev    next >
Text File  |  2001-12-19  |  11KB  |  341 lines

  1. //-------------------------------------------------------------------
  2. //
  3. //  This code is copyright 2001 by G5 Software.
  4. //  Any unauthorized usage, either in part or in whole of this code
  5. //  is strictly prohibited. Violators WILL be prosecuted to the
  6. //  maximum extent allowed by law.
  7. //
  8. //-------------------------------------------------------------------
  9.  
  10. class CDrawAttentionMission extends
  11.   CBaseMission, CDrawAttentionMissionObjectList, CDrawAttentionMission_Strings, CNavPointUser
  12. {
  13.   int GetAutoGeneratedUnitsQty()
  14.   {
  15.     return 6;
  16.   }
  17.  
  18.   void CDrawAttentionMission()
  19.   {
  20.     BaseMission_InitMission();
  21.  
  22.     BaseMission_UpdateLoadProgress();
  23.     CreateComponent("DebugCamera", "GameObject", "CDebugCamera");
  24.     SetComponentPosition("DebugCamera",
  25.       matrix(
  26.         1.0, 0.0, 0.0, 6090.0,
  27.         0.0, 1.0, 0.0, 5800.0,
  28.         0.0, 0.0, 1.0,  600.0,
  29.         0.0, 0.0, 0.0,    1.0
  30.       ));
  31.  
  32.     // CreateComponent(IDToRegister, ComponentID, ScriptName | FileName | "")
  33.     BaseMission_UpdateLoadProgress();
  34.     CreateComponent("Atmosphere", "Atmosphere", "CDrawAttentionMission_Atmosphere");
  35.  
  36.     BaseMission_UpdateLoadProgress();
  37.     CreateComponent("Sky", "SkyObject", "CDrawAttentionMission_Sky");
  38.  
  39.     BaseMission_UpdateLoadProgress();
  40.     CreateComponent("Terrain", "ProgressiveTerrainObject", "CDrawAttentionMission_Terrain");
  41.  
  42.     BaseMission_UpdateLoadProgress();
  43.     CreateComponent("Forest", "Forest", "CDrawAttentionMission_Forest");
  44.  
  45.     BaseMission_UpdateLoadProgress();
  46.     CreateComponent( "AIController", "AIController", "CMission11_AIController");
  47.  
  48.     BaseMission_CreateObjects();
  49.  
  50.    // Platoon ranking
  51.    SetBehaviorGroupRank( "11_Platoon_01", "Platoon_Rank", 1);
  52.    SetBehaviorGroupRank( "11_Platoon_02", "Platoon_Rank", 2);
  53.    SetBehaviorGroupRank( "11_Platoon_03", "Platoon_Rank", 3);
  54.    SetBehaviorGroupRank( "11_Platoon_04", "Platoon_Rank", 4);
  55.    SetBehaviorGroupRank( "11_Platoon_05", "Platoon_Rank", 5);
  56.    SetBehaviorGroupRank( "11_Platoon_06", "Platoon_Rank", 6);
  57.    SetBehaviorGroupRank( "11_Platoon_07", "Platoon_Rank", 7);
  58.    SetBehaviorGroupRank( "11_Platoon_08", "Platoon_Rank", 8);
  59.  
  60.    // Soviet Tank ranking
  61.    SetBehaviorGroupRank( "11_Soviet_Tank_01", "SovietTank_Rank", 1);
  62.    SetBehaviorGroupRank( "11_Soviet_Tank_02", "SovietTank_Rank", 2);
  63.    SetBehaviorGroupRank( "11_Soviet_Tank_03", "SovietTank_Rank", 3);
  64.    SetBehaviorGroupRank( "11_Soviet_Tank_04", "SovietTank_Rank", 4);
  65.  
  66.    // Soviet Katusha ranking
  67.    SetBehaviorGroupRank( "11_Katusha_01", "SovietKatusha_Rank", 1);
  68.    SetBehaviorGroupRank( "11_Katusha_02", "SovietKatusha_Rank", 2);
  69.    SetBehaviorGroupRank( "11_Katusha_03", "SovietKatusha_Rank", 3);
  70.    SetBehaviorGroupRank( "11_Katusha_04", "SovietKatusha_Rank", 4);
  71.    SetBehaviorGroupRank( "11_Katusha_05", "SovietKatusha_Rank", 5);
  72.    // Soviet Strike ranking
  73.    SetBehaviorGroupRank( "11_Soviet_Strike_01", "SovietStrike_Rank", 1);
  74.    SetBehaviorGroupRank( "11_Soviet_Strike_02", "SovietStrike_Rank", 2);
  75.    SetBehaviorGroupRank( "11_Soviet_Strike_03", "SovietStrike_Rank", 3);
  76.    SetBehaviorGroupRank( "11_Soviet_Strike_04", "SovietStrike_Rank", 4);
  77.    SetBehaviorGroupRank( "11_Soviet_Strike_05", "SovietStrike_Rank", 5);
  78.    SetBehaviorGroupRank( "11_Soviet_Strike_06", "SovietStrike_Rank", 6);
  79.    SetBehaviorGroupRank( "11_Soviet_Strike_07", "SovietStrike_Rank", 7);
  80.    SetBehaviorGroupRank( "11_Soviet_Strike_08", "SovietStrike_Rank", 8);
  81.    SetBehaviorGroupRank( "11_Soviet_Strike_09", "SovietStrike_Rank", 9);
  82.    SetBehaviorGroupRank( "11_Soviet_Strike_10", "SovietStrike_Rank", 10);
  83. // Nazi AntiAir Reserve ranking
  84.    SetBehaviorGroupRank( "11_Nazi_AA_Reserve_01", "NaziAAReserve_Rank", 1);
  85.    SetBehaviorGroupRank( "11_Nazi_AA_Reserve_02", "NaziAAReserve_Rank", 2);
  86.    SetBehaviorGroupRank( "11_Nazi_AA_Reserve_03", "NaziAAReserve_Rank", 3);
  87.    SetBehaviorGroupRank( "11_Nazi_AA_Reserve_04", "NaziAAReserve_Rank", 4);
  88.    SetBehaviorGroupRank( "11_Nazi_AA_Reserve_05", "NaziAAReserve_Rank", 5);
  89.    SetBehaviorGroupRank( "11_Nazi_AA_Reserve_06", "NaziAAReserve_Rank", 6);
  90.    SetBehaviorGroupRank( "11_Nazi_AA_Reserve_07", "NaziAAReserve_Rank", 7);
  91.    // Nazi Reserve ranking
  92.    SetBehaviorGroupRank( "11_Nazi_Reserve_01", "NaziReserve_Rank", 1);
  93.    SetBehaviorGroupRank( "11_Nazi_Reserve_02", "NaziReserve_Rank", 2);
  94.    SetBehaviorGroupRank( "11_Nazi_Reserve_03", "NaziReserve_Rank", 3);
  95.    SetBehaviorGroupRank( "11_Nazi_Reserve_04", "NaziReserve_Rank", 4);
  96.    SetBehaviorGroupRank( "11_Nazi_Reserve_05", "NaziReserve_Rank", 5);
  97.    SetBehaviorGroupRank( "11_Nazi_Reserve_06", "NaziReserve_Rank", 6);
  98.    SetBehaviorGroupRank( "11_Nazi_Reserve_07", "NaziReserve_Rank", 7);
  99.    SetBehaviorGroupRank( "11_Nazi_Reserve_08", "NaziReserve_Rank", 8);
  100.    SetBehaviorGroupRank( "11_Nazi_Reserve_09", "NaziReserve_Rank", 9);
  101.    SetBehaviorGroupRank( "11_Nazi_Reserve_10", "NaziReserve_Rank", 10);
  102.    // GB10 Defender ranking
  103.    SetBehaviorGroupRank( "11_GB10Defend_01", "GB10Defend_Rank", 1);
  104.    SetBehaviorGroupRank( "11_GB10Defend_02", "GB10Defend_Rank", 2);
  105.    SetBehaviorGroupRank( "11_GB10Defend_03", "GB10Defend_Rank", 3);
  106.    SetBehaviorGroupRank( "11_GB10Defend_04", "GB10Defend_Rank", 4);
  107.   }
  108.  
  109.   //
  110.   //  'virtual' methods
  111.   //
  112.  
  113.   //
  114.   //  Objectives
  115.  
  116.   array m_MissionObjectivesStatuses =
  117.           array(
  118.             str_ObjectiveInProgress,
  119.             str_ObjectiveInProgress,
  120.             str_ObjectiveInProgress
  121.           );
  122.  
  123.   array m_BonusMissionObjectivesStatuses =
  124.           array(
  125.             str_ObjectiveInProgress
  126.                   );
  127.  
  128.   //
  129.   //  Mission statistics
  130.  
  131.   string GetMissionStatistics()
  132.   {
  133.     return str_StatisticsTitle+German_Killed;
  134.   }
  135.  
  136.   //
  137.   //  Mission navpoints
  138.  
  139.   array GetNavPoints()
  140.   {
  141.     array navpoints =
  142.       array(
  143.         GetNavPoint("NavPoint_01"),
  144.         GetNavPoint("NavPoint_05"),
  145.         GetNavPoint("NavPoint_02"),
  146.         GetNavPoint("NavPoint_03")
  147.       );
  148.     return navpoints;
  149.   }
  150.  
  151.   //
  152.   //  Mission map skin file
  153.  
  154.   string GetMapSkinFileName()
  155.   {
  156.     return "Missions/Mission_11/Map.skin";
  157.   }
  158. //---------------------------------------------------------
  159.  
  160.   int Soviet_Killed            = 0;
  161.   int German_Killed            = 0;
  162.   int PlatoonKilled            = 0;
  163.   final int PlatoonKilledToWin = 8;
  164.   int CrossKilled              = 0;
  165.   final int CrossKilledToWin   = 12;
  166.   int SovietStrikeKilled       = 0;
  167.   final int SovietStrikeAmount = 10;
  168.   int NaziReserveKilled        = 0;
  169.   int NaziAAReserveKilled      = 0;
  170.   final int NaziReserveLost    = 10;
  171.   final int NaziAAReserveLost  = 7;
  172.   int SovietKatushasLeft       = 5;
  173.   boolean m_Objective1           = false;
  174.   boolean m_Objective2           = false;
  175.   boolean m_Objective3           = false;
  176.  
  177.   void OnSovietSrikeStop()
  178.   {
  179.     //
  180.     //  Soviet attack succeeded
  181.     //
  182.     m_Objective3 = true;
  183.     BaseMission_CompleteObjective(2);
  184. //    Core_LogMessage("Call CheckObjectives with Obj_3 is "+m_Objective3);
  185.     Core_BroadcastEvent("CheckObjectives");
  186.   }
  187.  
  188.   void OnConvoyKatushaStop()
  189.   {
  190.     //
  191.     //  Katushas arrived at their disposition
  192.     //
  193.  
  194.     Core_BroadcastEvent(
  195.         "OnDisplayMessage",
  196.         str_KatushasArrived,
  197.         m_GoodNewsColor
  198.       );
  199.   }
  200.  
  201.   void OnKatushaStartFire()
  202.   {
  203.     //
  204.     //  Katushas started an attack on the base
  205.     //
  206.  
  207.     Core_BroadcastEvent(
  208.         "OnDisplayMessage",
  209.         str_KatushasStartedFire,
  210.         m_GoodNewsColor
  211.       );
  212.   }
  213.  
  214.   void OnNaziReserveStart()
  215.   {
  216.     //
  217.     //  Nazi reserve departed from its location
  218.     //
  219.  
  220.     Core_BroadcastEvent(
  221.         "OnDisplayMessage",
  222.         str_ReserveMovedOut,
  223.         m_BadNewsColor
  224.       );
  225.   }
  226.   void OnGameObjectDestroyed(string _id)
  227.   {
  228.     BaseMission_OnGameObjectDestroyed(_id);
  229.     Core_BroadcastEvent( "Unit_Destroyed", _id);
  230.  
  231.     if ( Core_IsStringStartsWith( _id, "11_Soviet" ) )
  232.     {
  233.       Soviet_Killed = Soviet_Killed + 1;
  234.     }
  235.     else
  236.     {
  237.       German_Killed = German_Killed + 1;
  238.     }
  239.  
  240.     if ( Core_IsStringStartsWith( _id, "11_Platoon" ) )
  241.     {
  242.       PlatoonKilled =  PlatoonKilled + 1;
  243.       if ( PlatoonKilled >= PlatoonKilledToWin )
  244.       {
  245.         BaseMission_CompleteBonusObjective(0);
  246.       }
  247.     }
  248.     if ( Core_IsStringStartsWith( _id, "11_Cross" ))
  249.     {
  250.       Core_BroadcastEvent( "CrossRoadUnderAttack" );
  251.       CrossKilled = CrossKilled + 1;
  252.       if ( CrossKilled >= CrossKilledToWin )
  253.       {
  254.         m_Objective1 = true;
  255.         BaseMission_CompleteObjective(0);
  256.       }
  257.     }
  258.     if ( Core_IsStringStartsWith( _id, "11_Nazi_Reserve" ))
  259.     {
  260.       NaziReserveKilled = NaziReserveKilled + 1;
  261.     }
  262.     if ( Core_IsStringStartsWith( _id, "11_Nazi_AA_Reserve" ))
  263.     {
  264.       NaziAAReserveKilled = NaziAAReserveKilled + 1;
  265.     }
  266.  
  267.     if ( (NaziReserveKilled >= NaziReserveLost) && (NaziAAReserveKilled >= NaziAAReserveLost) && !m_Objective2 )
  268.     {
  269.       m_Objective2 = true;
  270.       BaseMission_CompleteObjective(1);
  271.     }
  272.  
  273.     if ( Core_IsStringStartsWith( _id, "11_Katusha" ))
  274.     {
  275.       //
  276.       //  Katusha killed
  277.       //
  278.       Core_BroadcastEvent(
  279.           "OnDisplayMessage",
  280.           str_KatushaDestroyed,
  281.           m_BadNewsColor
  282.         );
  283.       Core_SendEventTo(
  284.           "Helicopter",
  285.           "ShowEventObject",
  286.           _id,                      //     - id of object to show
  287.           70.0                      //     - distance from camera to object
  288.         );
  289.       SovietKatushasLeft = SovietKatushasLeft - 1;
  290.     }
  291.  
  292.     if ( Core_IsStringStartsWith( _id, "11_Soviet_Strike" ))
  293.     {
  294.       //
  295.       //  Soviet tank killed
  296.       //
  297.  
  298.       Core_BroadcastEvent(
  299.           "OnDisplayMessage",
  300.           str_TankDestroyed,
  301.           m_BadNewsColor
  302.         );
  303.       Core_SendEventTo(
  304.           "Helicopter",
  305.           "ShowEventObject",
  306.           _id,                      //     - id of object to show
  307.           70.0                      //     - distance from camera to object
  308.         );
  309.       SovietStrikeKilled = SovietStrikeKilled + 1;
  310.  
  311.       if ( SovietStrikeKilled >= SovietStrikeAmount )
  312.       {
  313.         //
  314.         //  All soviet units killed, mission failed?
  315.         //
  316.  
  317.         Core_BroadcastEvent(
  318.             "OnDisplayMessage",
  319.             str_AllTanksDestroyed,
  320.             m_BadNewsColor
  321.           );
  322.  
  323.         BaseMission_DelayedQuit();
  324.       }
  325.     }
  326.     if ( Core_IsStringStartsWith( _id, "11_Nazi_GB10_" ))
  327.     {
  328.       Core_BroadcastEvent( "Base10UnderAttack" );
  329.     }
  330.   }
  331.  
  332.   void OnMissionLoaded()
  333.   {
  334.     Core_SendEventTo("Helicopter", "OnInitiallyEnableTargetScreen", false);
  335.  
  336.     // Start mission music playing
  337.     Core_SendEventTo(SOID_MusicController, "PlayMissionMusic", 11);
  338.   }
  339. }
  340.  
  341.